
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>1、网络编程基础 · 王坤个人博客</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="wk">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism-duotone-dark.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://my.oschina.net/kunBlog" target="_blank" class="custom-link">我的博客地址</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../cassandra/">
            
                <a href="../../cassandra/">
            
                    
                    Cassandra
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../cassandra/1、cassandra的安装.html">
            
                <a href="../../cassandra/1、cassandra的安装.html">
            
                    
                    1、cassandra的安装
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../docker/">
            
                <a href="../../docker/">
            
                    
                    Docker
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../docker/1、docker与虚拟机的不同.html">
            
                <a href="../../docker/1、docker与虚拟机的不同.html">
            
                    
                    1、docker与虚拟机的不同
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../docker/2、镜像、容器、仓库.html">
            
                <a href="../../docker/2、镜像、容器、仓库.html">
            
                    
                    2、镜像、容器、仓库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../../docker/3、在centos中安装.html">
            
                <a href="../../docker/3、在centos中安装.html">
            
                    
                    3、在centos中安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../../docker/4、配置私有镜像仓库.html">
            
                <a href="../../docker/4、配置私有镜像仓库.html">
            
                    
                    4、配置私有镜像仓库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../../docker/5、docker的命令.html">
            
                <a href="../../docker/5、docker的命令.html">
            
                    
                    5、docker的命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../../docker/6、镜像的原理.html">
            
                <a href="../../docker/6、镜像的原理.html">
            
                    
                    6、镜像的原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../../docker/7、创建一个镜像.html">
            
                <a href="../../docker/7、创建一个镜像.html">
            
                    
                    7、创建一个镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../../docker/8、容器数据卷-持久化文件或目录.html">
            
                <a href="../../docker/8、容器数据卷-持久化文件或目录.html">
            
                    
                    8、容器数据卷(持久化文件或目录)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../../docker/9、dockerfile.html">
            
                <a href="../../docker/9、dockerfile.html">
            
                    
                    9、dockerfile
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../../docker/10、创建自己的tomcat镜像.html">
            
                <a href="../../docker/10、创建自己的tomcat镜像.html">
            
                    
                    10、创建自己的tomcat镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../../docker/11、使用docker安装mysql和redis.html">
            
                <a href="../../docker/11、使用docker安装mysql和redis.html">
            
                    
                    11、使用docker安装mysql和redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../../docker/12、把本地镜像发布到阿里云.html">
            
                <a href="../../docker/12、把本地镜像发布到阿里云.html">
            
                    
                    12、把本地镜像发布到阿里云
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../">
            
                <a href="../">
            
                    
                    Golang
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" >
            
                <span>
            
                    
                    Examples
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../examples/1、生成随机数.html">
            
                <a href="../examples/1、生成随机数.html">
            
                    
                    1、生成随机数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../examples/2、数组冒泡排序.html">
            
                <a href="../examples/2、数组冒泡排序.html">
            
                    
                    2、数组冒泡排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.3" data-path="../examples/3、二分查找.html">
            
                <a href="../examples/3、二分查找.html">
            
                    
                    3、二分查找
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.4" data-path="../examples/4、工厂模式.html">
            
                <a href="../examples/4、工厂模式.html">
            
                    
                    4、工厂模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.5" data-path="../examples/5、对切片排序.html">
            
                <a href="../examples/5、对切片排序.html">
            
                    
                    5、对切片排序
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" >
            
                <span>
            
                    
                    go的命令行
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.2.1" data-path="../go的命令行/1、go的get命令.html">
            
                <a href="../go的命令行/1、go的get命令.html">
            
                    
                    1、go get 命令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3" >
            
                <span>
            
                    
                    json序列化
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.3.1" data-path="../json序列化/1、json序列化.html">
            
                <a href="../json序列化/1、json序列化.html">
            
                    
                    1、json序列化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2" data-path="../json序列化/2、json反序列化.html">
            
                <a href="../json序列化/2、json反序列化.html">
            
                    
                    2、json反序列化
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4" >
            
                <span>
            
                    
                    包管理工具
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.1" data-path="../包管理工具/dep包管理工具.html">
            
                <a href="../包管理工具/dep包管理工具.html">
            
                    
                    dep包管理工具
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.5" >
            
                <span>
            
                    
                    协程和管道
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.5.1" data-path="../协程和管道/1、goroutine基础.html">
            
                <a href="../协程和管道/1、goroutine基础.html">
            
                    
                    1、goroutine基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.2" data-path="../协程和管道/2、goroutine的调度模型.html">
            
                <a href="../协程和管道/2、goroutine的调度模型.html">
            
                    
                    2、goroutine的调度模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.3" data-path="../协程和管道/3、全局锁和管道.html">
            
                <a href="../协程和管道/3、全局锁和管道.html">
            
                    
                    3、全局锁和管道
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.4" data-path="../协程和管道/4、管道.html">
            
                <a href="../协程和管道/4、管道.html">
            
                    
                    4、管道
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.5" data-path="../协程和管道/5、管道的注意点.html">
            
                <a href="../协程和管道/5、管道的注意点.html">
            
                    
                    5、管道的注意点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.6" >
            
                <span>
            
                    
                    单元测试
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.6.1" data-path="../单元测试/1、单元测试入门.html">
            
                <a href="../单元测试/1、单元测试入门.html">
            
                    
                    1、单元测试入门
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.7" >
            
                <span>
            
                    
                    反射
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.7.1" data-path="../反射/1、反射.html">
            
                <a href="../反射/1、反射.html">
            
                    
                    1、反射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7.2" data-path="../反射/2、反射的使用细节.html">
            
                <a href="../反射/2、反射的使用细节.html">
            
                    
                    2、反射的使用细节
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.8" >
            
                <span>
            
                    
                    常量
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.8.1" data-path="../常量/1、常量.html">
            
                <a href="../常量/1、常量.html">
            
                    
                    1、常量
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.9" >
            
                <span>
            
                    
                    文件操作
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.9.1" data-path="../文件操作/1、读取文件.html">
            
                <a href="../文件操作/1、读取文件.html">
            
                    
                    1、读取文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9.2" data-path="../文件操作/2、写文件.html">
            
                <a href="../文件操作/2、写文件.html">
            
                    
                    2、写文件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.10" >
            
                <span>
            
                    
                    网络编程
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.4.10.1" data-path="1、网络编程基础.html">
            
                <a href="1、网络编程基础.html">
            
                    
                    1、网络编程基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.11" >
            
                <span>
            
                    
                    面向对象
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.11.1" data-path="../面向对象/1、go使用struct实现OOP.html">
            
                <a href="../面向对象/1、go使用struct实现OOP.html">
            
                    
                    1、go使用struct实现OOP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11.2" data-path="../面向对象/2、方法.html">
            
                <a href="../面向对象/2、方法.html">
            
                    
                    2、方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11.3" data-path="../面向对象/3、封装.html">
            
                <a href="../面向对象/3、封装.html">
            
                    
                    3、封装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11.4" data-path="../面向对象/4、继承.html">
            
                <a href="../面向对象/4、继承.html">
            
                    
                    4、继承
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11.5" data-path="../面向对象/5、接口.html">
            
                <a href="../面向对象/5、接口.html">
            
                    
                    5、接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11.6" data-path="../面向对象/6、多肽.html">
            
                <a href="../面向对象/6、多肽.html">
            
                    
                    6、多肽
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11.7" data-path="../面向对象/7、类型断言.html">
            
                <a href="../面向对象/7、类型断言.html">
            
                    
                    7、类型断言
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.12" data-path="../1、windows下安装golang环境.html">
            
                <a href="../1、windows下安装golang环境.html">
            
                    
                    1、windows下安装golang环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.13" data-path="../2、webStorm安装go语言插件.html">
            
                <a href="../2、webStorm安装go语言插件.html">
            
                    
                    2、webStorm安装go语言插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.14" data-path="../3、go的一些语法风格.html">
            
                <a href="../3、go的一些语法风格.html">
            
                    
                    3、go的一些语法风格
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.15" data-path="../4、go语法-变量.html">
            
                <a href="../4、go语法-变量.html">
            
                    
                    4、go语法-变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.16" data-path="../5、go语法--数据类型.html">
            
                <a href="../5、go语法--数据类型.html">
            
                    
                    5、go语法--数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.17" data-path="../6、go的整数类型.html">
            
                <a href="../6、go的整数类型.html">
            
                    
                    6、go的整数类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.18" data-path="../7、go的浮点类型.html">
            
                <a href="../7、go的浮点类型.html">
            
                    
                    7、go的浮点类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.19" data-path="../8、go的字符类型.html">
            
                <a href="../8、go的字符类型.html">
            
                    
                    8、go的字符类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.20" data-path="../9、go的bool类型.html">
            
                <a href="../9、go的bool类型.html">
            
                    
                    9、go的bool类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.21" data-path="../10、go的string类型.html">
            
                <a href="../10、go的string类型.html">
            
                    
                    10、go的string类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.22" data-path="../11、基本数据类型相互转换.html">
            
                <a href="../11、基本数据类型相互转换.html">
            
                    
                    11、基本数据类型相互转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.23" data-path="../12、基本数据类型和string的转换.html">
            
                <a href="../12、基本数据类型和string的转换.html">
            
                    
                    12、基本数据类型和string的转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.24" data-path="../13、go的指针.html">
            
                <a href="../13、go的指针.html">
            
                    
                    13、go的指针
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.25" data-path="../14、go的标识符.html">
            
                <a href="../14、go的标识符.html">
            
                    
                    14、go的标识符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.26" data-path="../15、go的关键字.html">
            
                <a href="../15、go的关键字.html">
            
                    
                    15、go的关键字
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.27" data-path="../16、go的运算符-算术运算.html">
            
                <a href="../16、go的运算符-算术运算.html">
            
                    
                    16、go的运算符-算术运算
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.28" data-path="../17、比较、赋值、逻辑运算符.html">
            
                <a href="../17、比较、赋值、逻辑运算符.html">
            
                    
                    17、比较、赋值、逻辑运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.29" data-path="../18、运算符的优先级.html">
            
                <a href="../18、运算符的优先级.html">
            
                    
                    18、运算符的优先级
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.30" data-path="../19、其他运算符.html">
            
                <a href="../19、其他运算符.html">
            
                    
                    19、其他运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.31" data-path="../20、go获取键盘输入.html">
            
                <a href="../20、go获取键盘输入.html">
            
                    
                    20、go获取键盘输入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.32" data-path="../21、进制、位运算.html">
            
                <a href="../21、进制、位运算.html">
            
                    
                    21、进制、位运算
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.33" data-path="../22、if和switch语句.html">
            
                <a href="../22、if和switch语句.html">
            
                    
                    22、if和switch语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.34" data-path="../23、for循环.html">
            
                <a href="../23、for循环.html">
            
                    
                    23、for循环
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.35" data-path="../24、goto语句.html">
            
                <a href="../24、goto语句.html">
            
                    
                    24、goto语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.36" data-path="../25、函数1.html">
            
                <a href="../25、函数1.html">
            
                    
                    25、函数1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.37" data-path="../26、包-package.html">
            
                <a href="../26、包-package.html">
            
                    
                    26、包-package
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.38" data-path="../27、init函数.html">
            
                <a href="../27、init函数.html">
            
                    
                    27、init函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.39" data-path="../28、匿名函数.html">
            
                <a href="../28、匿名函数.html">
            
                    
                    28、匿名函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.40" data-path="../29、闭包.html">
            
                <a href="../29、闭包.html">
            
                    
                    29、闭包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.41" data-path="../30、defer.html">
            
                <a href="../30、defer.html">
            
                    
                    30、defer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.42" data-path="../31、值传递和引用传递.html">
            
                <a href="../31、值传递和引用传递.html">
            
                    
                    31、值传递和引用传递
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.43" data-path="../32、常用字符串函数.html">
            
                <a href="../32、常用字符串函数.html">
            
                    
                    32、常用字符串函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.44" data-path="../33、时间和日期函数.html">
            
                <a href="../33、时间和日期函数.html">
            
                    
                    33、时间和日期函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.45" data-path="../34、go语言的内置函数.html">
            
                <a href="../34、go语言的内置函数.html">
            
                    
                    34、go语言的内置函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.46" data-path="../35、go语言的错误处理.html">
            
                <a href="../35、go语言的错误处理.html">
            
                    
                    35、go语言的错误处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.47" data-path="../36、数组.html">
            
                <a href="../36、数组.html">
            
                    
                    36、数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.48" data-path="../37、切片slice.html">
            
                <a href="../37、切片slice.html">
            
                    
                    37、切片slice
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.49" data-path="../38、string和slice.html">
            
                <a href="../38、string和slice.html">
            
                    
                    38、string 和 slice
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.50" data-path="../39、二维数组.html">
            
                <a href="../39、二维数组.html">
            
                    
                    39、二维数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.51" data-path="../40、map的用法.html">
            
                <a href="../40、map的用法.html">
            
                    
                    40、map的用法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.52" data-path="../41、获取命令行参数.html">
            
                <a href="../41、获取命令行参数.html">
            
                    
                    41、获取命令行参数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../Istio/">
            
                <a href="../../Istio/">
            
                    
                    Istio
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../redis/">
            
                <a href="../../redis/">
            
                    
                    Redis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" >
            
                <span>
            
                    
                    golang连接redis
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1.1" data-path="../../redis/golang连接redis/1、go语言连接使用redis.html">
            
                <a href="../../redis/golang连接redis/1、go语言连接使用redis.html">
            
                    
                    1、go语言连接使用redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.2" data-path="../../redis/golang连接redis/2、redis连接池.html">
            
                <a href="../../redis/golang连接redis/2、redis连接池.html">
            
                    
                    2、redis连接池
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.2" >
            
                <span>
            
                    
                    protected-mode设置
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.1" data-path="../../redis/protected-mode设置/1、设置保护模式.html">
            
                <a href="../../redis/protected-mode设置/1、设置保护模式.html">
            
                    
                    1、设置保护模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../../redis/1、redis的安装.html">
            
                <a href="../../redis/1、redis的安装.html">
            
                    
                    1、redis的安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../../redis/2、redis数据库的命令操作.html">
            
                <a href="../../redis/2、redis数据库的命令操作.html">
            
                    
                    2、redis数据库的命令操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../../redis/3、string类型的操作.html">
            
                <a href="../../redis/3、string类型的操作.html">
            
                    
                    3、string类型的操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../../redis/4、hash类型的操作.html">
            
                <a href="../../redis/4、hash类型的操作.html">
            
                    
                    4、hash类型的操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../../redis/5、list类型的操作.html">
            
                <a href="../../redis/5、list类型的操作.html">
            
                    
                    5、list类型的操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../../redis/6、Set类型的操作.html">
            
                <a href="../../redis/6、Set类型的操作.html">
            
                    
                    6、Set类型的操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../../redis/7、docker安装redis.html">
            
                <a href="../../redis/7、docker安装redis.html">
            
                    
                    7、docker安装redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="../../redis/8、redis集群搭建.html">
            
                <a href="../../redis/8、redis集群搭建.html">
            
                    
                    8、redis集群搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11" data-path="../../redis/9、zset类型的操作.html">
            
                <a href="../../redis/9、zset类型的操作.html">
            
                    
                    9、zset类型的操作
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    数据结构和算法
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../../数据结构和算法/1、稀疏数组.html">
            
                <a href="../../数据结构和算法/1、稀疏数组.html">
            
                    
                    1、稀疏数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../../数据结构和算法/2、队列.html">
            
                <a href="../../数据结构和算法/2、队列.html">
            
                    
                    2、队列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../../数据结构和算法/3、单向链表.html">
            
                <a href="../../数据结构和算法/3、单向链表.html">
            
                    
                    3、单向链表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../../数据结构和算法/4、双向链表.html">
            
                <a href="../../数据结构和算法/4、双向链表.html">
            
                    
                    4、双向链表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../../数据结构和算法/5、单向环形链表.html">
            
                <a href="../../数据结构和算法/5、单向环形链表.html">
            
                    
                    5、单向环形链表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../../数据结构和算法/6、约瑟夫问题.html">
            
                <a href="../../数据结构和算法/6、约瑟夫问题.html">
            
                    
                    6、约瑟夫问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../../数据结构和算法/7、选择排序.html">
            
                <a href="../../数据结构和算法/7、选择排序.html">
            
                    
                    7、选择排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../../数据结构和算法/8、插入排序.html">
            
                <a href="../../数据结构和算法/8、插入排序.html">
            
                    
                    8、插入排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../../数据结构和算法/9、快速排序法.html">
            
                <a href="../../数据结构和算法/9、快速排序法.html">
            
                    
                    9、快速排序法
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../../springCloud/">
            
                <a href="../../springCloud/">
            
                    
                    springCloud
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../../springCloud/consul/">
            
                <a href="../../springCloud/consul/">
            
                    
                    consul
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1.1" data-path="../../springCloud/consul/1、springcloud服务注册到consul.html">
            
                <a href="../../springCloud/consul/1、springcloud服务注册到consul.html">
            
                    
                    1、springcloud服务注册到consul
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.1.2" data-path="../../springCloud/consul/2、springcloud消费consul中注册的服务.html">
            
                <a href="../../springCloud/consul/2、springcloud消费consul中注册的服务.html">
            
                    
                    2、springcloud消费consul中注册的服务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.1.3" data-path="../../springCloud/consul/3、springcloud使用consul做配置中心.html">
            
                <a href="../../springCloud/consul/3、springcloud使用consul做配置中心.html">
            
                    
                    3、springcloud使用consul做配置中心
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../../springCloud/springBoot/">
            
                <a href="../../springCloud/springBoot/">
            
                    
                    springBoot
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.2.1" >
            
                <span>
            
                    
                    一些问题解决方式
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.2.1.1" data-path="../../springCloud/springBoot/一些问题解决方式/1、StreamingResponseBody问题.html">
            
                <a href="../../springCloud/springBoot/一些问题解决方式/1、StreamingResponseBody问题.html">
            
                    
                    1、StreamingResponseBody问题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8.2.2" data-path="../../springCloud/springBoot/1、新建springboot工程.html">
            
                <a href="../../springCloud/springBoot/1、新建springboot工程.html">
            
                    
                    1、新建springboot工程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../../springCloud/1、Eureka服务注册中心.html">
            
                <a href="../../springCloud/1、Eureka服务注册中心.html">
            
                    
                    1、Eureka服务注册中心
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../../springCloud/2、服务调用.html">
            
                <a href="../../springCloud/2、服务调用.html">
            
                    
                    2、服务调用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../../springCloud/3、断路器hystrix的使用.html">
            
                <a href="../../springCloud/3、断路器hystrix的使用.html">
            
                    
                    3、断路器hystrix的使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../../springCloud/4、断路器hystrix的隔离策略.html">
            
                <a href="../../springCloud/4、断路器hystrix的隔离策略.html">
            
                    
                    4、断路器hystrix的隔离策略
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="../../springCloud/5、hystrix的Dashboard和Turbine.html">
            
                <a href="../../springCloud/5、hystrix的Dashboard和Turbine.html">
            
                    
                    5、hystrix的Dashboard和Turbine
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../../vpn/">
            
                <a href="../../vpn/">
            
                    
                    Vpn
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../../vpn/1、ss服务器的安装.html">
            
                <a href="../../vpn/1、ss服务器的安装.html">
            
                    
                    1、ss服务器的安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../../vpn/2、SS客户端.html">
            
                <a href="../../vpn/2、SS客户端.html">
            
                    
                    2、SS客户端
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" >
            
                <span>
            
                    
                    gitbook的使用
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../../gitbook的使用/1、gitbook的使用.html">
            
                <a href="../../gitbook的使用/1、gitbook的使用.html">
            
                    
                    1、gitbook 的使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../../gitbook的使用/2、gitbook命令.html">
            
                <a href="../../gitbook的使用/2、gitbook命令.html">
            
                    
                    2、gitbook命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../../gitbook的使用/3、gitbook连续大括号的解决方式.html">
            
                <a href="../../gitbook的使用/3、gitbook连续大括号的解决方式.html">
            
                    
                    3、gitbook连续大括号的解决方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../../gitbook的使用/4、gitbook插件.html">
            
                <a href="../../gitbook的使用/4、gitbook插件.html">
            
                    
                    4、gitbook插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../../gitbook的使用/5、去掉-本书由gitbook发布.html">
            
                <a href="../../gitbook的使用/5、去掉-本书由gitbook发布.html">
            
                    
                    5、去掉-本书由gitbook发布
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" >
            
                <span>
            
                    
                    markdown学习
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../../markdown学习/1、markdown的学习.html">
            
                <a href="../../markdown学习/1、markdown的学习.html">
            
                    
                    1、markdown的学习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../../keycloak/">
            
                <a href="../../keycloak/">
            
                    
                    keycloak
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../../keycloak/1、keycloak的简单使用.html">
            
                <a href="../../keycloak/1、keycloak的简单使用.html">
            
                    
                    1、keycloak的简单使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" >
            
                <span>
            
                    
                    分布式事务
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../../分布式事务/1、事务的介绍.html">
            
                <a href="../../分布式事务/1、事务的介绍.html">
            
                    
                    1、事务的介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../../分布式事务/2、分布式事务的理论.html">
            
                <a href="../../分布式事务/2、分布式事务的理论.html">
            
                    
                    2、分布式事务的理论
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >1、网络编程基础</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><ul><ul><li><span class="title-icon "></span><a href="#&#x4E00;&#x3001;&#x534F;&#x8BAE;&#x4E4B;&#x95F4;&#x7684;&#x5173;&#x7CFB;&#x3002;"><b>1.1.1. </b>&#x4E00;&#x3001;&#x534F;&#x8BAE;&#x4E4B;&#x95F4;&#x7684;&#x5173;&#x7CFB;&#x3002;</a></li><li><span class="title-icon "></span><a href="#&#x4E8C;&#x3001;tcpip-&#x534F;&#x8BAE;&#x3002;"><b>1.1.2. </b>&#x4E8C;&#x3001;TCP/IP &#x534F;&#x8BAE;&#x3002;</a></li><li><span class="title-icon "></span><a href="#&#x4E09;&#x3001;tcp&#x670D;&#x52A1;&#x5668;&#x3001;&#x5BA2;&#x6237;&#x7AEF;&#x901A;&#x4FE1;&#x7684;&#x5B9E;&#x73B0;&#x3002;"><b>1.1.3. </b>&#x4E09;&#x3001;tcp&#x670D;&#x52A1;&#x5668;&#x3001;&#x5BA2;&#x6237;&#x7AEF;&#x901A;&#x4FE1;&#x7684;&#x5B9E;&#x73B0;&#x3002;</a></li></ul></ul></ul></div><a href="#" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h3 id="&#x4E00;&#x3001;&#x534F;&#x8BAE;&#x4E4B;&#x95F4;&#x7684;&#x5173;&#x7CFB;&#x3002;"><a name="&#x4E00;&#x3001;&#x534F;&#x8BAE;&#x4E4B;&#x95F4;&#x7684;&#x5173;&#x7CFB;&#x3002;" class="anchor-navigation-ex-anchor" href="#&#x4E00;&#x3001;&#x534F;&#x8BAE;&#x4E4B;&#x95F4;&#x7684;&#x5173;&#x7CFB;&#x3002;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.1. &#x4E00;&#x3001;&#x534F;&#x8BAE;&#x4E4B;&#x95F4;&#x7684;&#x5173;&#x7CFB;&#x3002;</h3>
<p>1&#x3001;socket &#x5C01;&#x88C5;&#x4E86; TCP/IP&#x534F;&#x8BAE;&#x3002;</p>
<p>2&#x3001;HTTP &#x534F;&#x8BAE;(HyperText Transfer Protocol&#xFF0C;&#x8D85;&#x6587;&#x672C;&#x4F20;&#x8F93;&#x534F;&#x8BAE;) &#x5C01;&#x88C5;&#x4E86; socket&#x3002;</p>
<p>3&#x3001;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x8981;&#x81EA;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;&#x534F;&#x8BAE;&#xFF0C;&#x662F;&#x548C;HTTP&#x662F;&#x4E00;&#x5C42;&#x7684;&#x3002;&#x76F8;&#x5F53;&#x4E8E;&#x628A;HTTP&#x66FF;&#x6362;&#x4E3A;&#x81EA;&#x5DF1;&#x7684;&#x534F;&#x8BAE;&#x3002;&#x6BD4;&#x5982;&#xFF1A;&#x4F7F;&#x7528;protobuf&#x5B9A;&#x4E49;&#x4E86;&#x81EA;&#x5DF1;&#x7684;&#x534F;&#x8BAE;&#x3002;</p>
<h3 id="&#x4E8C;&#x3001;tcpip-&#x534F;&#x8BAE;&#x3002;"><a name="&#x4E8C;&#x3001;tcpip-&#x534F;&#x8BAE;&#x3002;" class="anchor-navigation-ex-anchor" href="#&#x4E8C;&#x3001;tcpip-&#x534F;&#x8BAE;&#x3002;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.2. &#x4E8C;&#x3001;TCP/IP &#x534F;&#x8BAE;&#x3002;</h3>
<h4 id="1&#x3001;tcpip-&#x534F;&#x8BAE;&#x3002;"><a name="1&#x3001;tcpip-&#x534F;&#x8BAE;&#x3002;" class="anchor-navigation-ex-anchor" href="#1&#x3001;tcpip-&#x534F;&#x8BAE;&#x3002;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>1&#x3001;TCP/IP &#x534F;&#x8BAE;&#x3002;</strong></h4>
<p>TCP/IP&#xFF08;Transmission Control Protocol/Internet Protocol &#x7684;&#x7B80;&#x5199;&#xFF09;&#xFF0C;&#x4E2D;&#x6587;&#x4E3A;&#x4F20;&#x8F93;&#x63A7;&#x5236;&#x534F;&#x8BAE;/&#x56E0;&#x7279;&#x7F51;&#x4E92;&#x8054;&#x534F;&#x8BAE;&#xFF0C;&#x53C8;&#x53EB;&#x7F51;&#x7EDC;&#x901A;&#x8BAF;&#x534F;&#x8BAE;&#xFF0C;&#x8FD9;&#x4E2A;&#x534F;&#x8BAE;&#x662F; Internet &#x6700;&#x57FA;&#x672C;&#x7684;&#x534F;&#x8BAE;&#x3001;Internet &#x56FD;&#x9645;&#x4E92;&#x8054;&#x7F51;&#x7EDC;&#x7684;&#x57FA;&#x7840;&#xFF0C;&#x7B80;&#x5355;&#x5730;&#x8BF4;&#xFF0C;&#x5C31;&#x662F;&#x7531;&#x7F51;&#x7EDC;&#x5C42;&#x7684; IP &#x534F;&#x8BAE;&#x548C;&#x4F20;&#x8F93;&#x5C42;&#x7684; TCP &#x534F;&#x8BAE;&#x7EC4;&#x6210;&#x7684;&#x3002;</p>
<h4 id="2&#x3001;ip&#x5730;&#x5740;&#x3002;"><a name="2&#x3001;ip&#x5730;&#x5740;&#x3002;" class="anchor-navigation-ex-anchor" href="#2&#x3001;ip&#x5730;&#x5740;&#x3002;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>2&#x3001;IP&#x5730;&#x5740;&#x3002;</strong></h4>
<p>&#x6BCF;&#x4E2A; internet &#x4E0A;&#x7684;&#x4E3B;&#x673A;&#x548C;&#x8DEF;&#x7531;&#x5668;&#x90FD;&#x6709;&#x4E00;&#x4E2A; ip &#x5730;&#x5740;&#xFF0C;&#x5B83;&#x5305;&#x62EC;&#x7F51;&#x7EDC;&#x53F7;&#x548C;&#x4E3B;&#x673A;&#x53F7;&#xFF0C;ip &#x5730;&#x5740;&#x6709; ipv4(4&#x5B57;&#x8282;&#xFF0C;32 &#x4F4D;)&#x6216;&#x8005; ipv6(16&#x5B57;&#x8282;&#xFF0C;128 &#x4F4D;)&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; ipconfig &#x6765;&#x67E5;&#x770B;&#x3002;</p>
<h4 id="3&#x3001;&#x7AEF;&#x53E3;&#x3002;"><a name="3&#x3001;&#x7AEF;&#x53E3;&#x3002;" class="anchor-navigation-ex-anchor" href="#3&#x3001;&#x7AEF;&#x53E3;&#x3002;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>3&#x3001;&#x7AEF;&#x53E3;&#x3002;</strong></h4>
<p>&#x7535;&#x8111;&#x7684;&#x7AEF;&#x53E3;&#x6709;2&#x5B57;&#x8282;&#xFF0C;16&#x4F4D;&#x3002;&#x8303;&#x56F4;&#x662F;&#x4ECE; 0  &#x5230; 65535&#xFF08;2&#x7684;16&#x6B21;&#x65B9;-1&#xFF09;&#x3002;</p>
<blockquote>
<p>&#x53EF;&#x4EE5;&#x4F7F;&#x7528; netstat &#x2013;an &#x53EF;&#x4EE5;&#x67E5;&#x770B;&#x672C;&#x673A;&#x6709;&#x54EA;&#x4E9B;&#x7AEF;&#x53E3;&#x5728;&#x76D1;&#x542C;&#x3002;&#x4F7F;&#x7528; netstat &#x2013;anb &#x6765;&#x67E5;&#x770B;&#x76D1;&#x542C;&#x7AEF;&#x53E3;&#x7684; pid&#x3002;</p>
</blockquote>
<h3 id="&#x4E09;&#x3001;tcp&#x670D;&#x52A1;&#x5668;&#x3001;&#x5BA2;&#x6237;&#x7AEF;&#x901A;&#x4FE1;&#x7684;&#x5B9E;&#x73B0;&#x3002;"><a name="&#x4E09;&#x3001;tcp&#x670D;&#x52A1;&#x5668;&#x3001;&#x5BA2;&#x6237;&#x7AEF;&#x901A;&#x4FE1;&#x7684;&#x5B9E;&#x73B0;&#x3002;" class="anchor-navigation-ex-anchor" href="#&#x4E09;&#x3001;tcp&#x670D;&#x52A1;&#x5668;&#x3001;&#x5BA2;&#x6237;&#x7AEF;&#x901A;&#x4FE1;&#x7684;&#x5B9E;&#x73B0;&#x3002;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.3. &#x4E09;&#x3001;tcp&#x670D;&#x52A1;&#x5668;&#x3001;&#x5BA2;&#x6237;&#x7AEF;&#x901A;&#x4FE1;&#x7684;&#x5B9E;&#x73B0;&#x3002;</h3>
<p>go&#x8BED;&#x8A00;&#x7F51;&#x7EDC;&#x7F16;&#x7A0B;&#x662F;&#x5728;net&#x5305;&#x4E0B;&#x9762;&#x3002;</p>
<h4 id="1&#x3001;&#x670D;&#x52A1;&#x5668;-servergo-&#x4EE3;&#x7801;&#xFF1A;"><a name="1&#x3001;&#x670D;&#x52A1;&#x5668;-servergo-&#x4EE3;&#x7801;&#xFF1A;" class="anchor-navigation-ex-anchor" href="#1&#x3001;&#x670D;&#x52A1;&#x5668;-servergo-&#x4EE3;&#x7801;&#xFF1A;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>1&#x3001;&#x670D;&#x52A1;&#x5668; server.go &#x4EE3;&#x7801;&#xFF1A;</strong></h4>
<p>&#x5B9E;&#x73B0;&#x6548;&#x679C;&#xFF1A;&#x670D;&#x52A1;&#x5668;&#x76D1;&#x542C;8888&#x7AEF;&#x53E3;&#xFF0C;&#x7B49;&#x5F85;&#x5BA2;&#x6237;&#x7AEF;&#x8FDE;&#x63A5;&#x3002;&#x5BA2;&#x6237;&#x7AEF;&#x8FDE;&#x63A5;&#x4E4B;&#x540E;&#xFF0C;&#x5F00;&#x542F;&#x4E00;&#x4E2A;&#x534F;&#x7A0B;&#x5904;&#x7406;&#x5BA2;&#x6237;&#x7AEF;&#x8FDE;&#x63A5;&#x3002;&#x8FD9;&#x65F6;&#x5019;&#x670D;&#x52A1;&#x5668;&#x548C;&#x5BA2;&#x6237;&#x7AEF;&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x4E00;&#x4E2A;<strong>tcp&#x957F;&#x8FDE;&#x63A5;</strong>&#x3002;&#x5BA2;&#x6237;&#x7AEF;&#x548C;&#x670D;&#x52A1;&#x5668;&#x4E00;&#x76F4;&#x53EF;&#x4EE5;&#x4E92;&#x76F8;&#x53D1;&#x4FE1;&#x606F;&#x901A;&#x4FE1;&#x3002;&#x5B83;&#x4EEC;&#x662F;&#x53CC;&#x5DE5;&#x7684;&#x3002;</p>
<pre class="language-"><code class="lang-go"><span class="token keyword">package</span> main

<span class="token keyword">import</span> <span class="token punctuation">(</span>
    <span class="token string">&quot;fmt&quot;</span>
    <span class="token string">&quot;net&quot;</span>
<span class="token punctuation">)</span>

<span class="token comment">// &#x5904;&#x7406;&#x8BF7;&#x6C42;</span>
<span class="token keyword">func</span> <span class="token function">processTest</span><span class="token punctuation">(</span>conn net<span class="token punctuation">.</span>Conn<span class="token punctuation">)</span>  <span class="token punctuation">{</span>
    <span class="token comment">//&#x5173;&#x95ED;&#x8FDE;&#x63A5;</span>
    <span class="token keyword">defer</span> conn<span class="token punctuation">.</span><span class="token function">Close</span><span class="token punctuation">(</span><span class="token punctuation">)</span>

    <span class="token comment">//&#x5FAA;&#x73AF;&#x63A5;&#x6536;&#x5BA2;&#x6237;&#x7AEF;&#x53D1;&#x9001;&#x7684;&#x6570;&#x636E;</span>
    <span class="token keyword">for</span> <span class="token punctuation">{</span>
        buf <span class="token operator">:=</span> <span class="token function">make</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token builtin">byte</span><span class="token punctuation">,</span><span class="token number">1024</span><span class="token punctuation">)</span> <span class="token comment">//&#x521B;&#x5EFA;&#x5207;&#x7247;&#x63A5;&#x6536;&#x6570;&#x636E;</span>

        <span class="token comment">//fmt.Printf(&quot;&#x7B49;&#x5F85;&#x5BA2;&#x6237;&#x7AEF; %s &#x53D1;&#x9001;&#x6570;&#x636E; \n&quot;,conn.RemoteAddr())</span>
        n<span class="token punctuation">,</span> err <span class="token operator">:=</span> conn<span class="token punctuation">.</span><span class="token function">Read</span><span class="token punctuation">(</span>buf<span class="token punctuation">)</span> <span class="token comment">//&#x963B;&#x585E;&#x7B49;&#x5F85;&#x63A5;&#x6536;&#x5BA2;&#x6237;&#x7AEF;&#x4FE1;&#x606F;&#x3002;</span>
        <span class="token keyword">if</span> err <span class="token operator">!=</span> <span class="token boolean">nil</span> <span class="token punctuation">{</span>
            fmt<span class="token punctuation">.</span><span class="token function">Println</span><span class="token punctuation">(</span><span class="token string">&quot;&#x670D;&#x52A1;&#x7AEF;Read &#x9519;&#x8BEF; err=&quot;</span><span class="token punctuation">,</span>err<span class="token punctuation">)</span>
            <span class="token keyword">return</span>
        <span class="token punctuation">}</span>

        <span class="token comment">//&#x663E;&#x793A;&#x670D;&#x52A1;&#x7AEF;&#x53D1;&#x9001;&#x7684;&#x5185;&#x5BB9;&#xFF0C;n&#x8868;&#x793A;&#x5B9E;&#x9645;&#x8BFB;&#x5230;&#x7684;&#x5B57;&#x8282;&#x6570;</span>
        fmt<span class="token punctuation">.</span><span class="token function">Print</span><span class="token punctuation">(</span><span class="token string">&quot;&#x5BA2;&#x6237;&#x7AEF;&#x7684;&#x6570;&#x636E;=&quot;</span><span class="token punctuation">,</span><span class="token function">string</span><span class="token punctuation">(</span>buf<span class="token punctuation">[</span><span class="token punctuation">:</span>n<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

<span class="token punctuation">}</span>

<span class="token keyword">func</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    fmt<span class="token punctuation">.</span><span class="token function">Println</span><span class="token punctuation">(</span><span class="token string">&quot;&#x670D;&#x52A1;&#x5668;&#x5F00;&#x59CB;&#x76D1;&#x542C;&#x3002;&#x3002;&#x3002;&quot;</span><span class="token punctuation">)</span>
    <span class="token comment">//&#x672C;&#x5730;&#x76D1;&#x542C; 8888 &#x7AEF;&#x53E3;</span>
    listener<span class="token punctuation">,</span> err <span class="token operator">:=</span> net<span class="token punctuation">.</span><span class="token function">Listen</span><span class="token punctuation">(</span><span class="token string">&quot;tcp&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;0.0.0.0:8888&quot;</span><span class="token punctuation">)</span>

    <span class="token keyword">if</span> err <span class="token operator">!=</span> <span class="token boolean">nil</span> <span class="token punctuation">{</span>
        fmt<span class="token punctuation">.</span><span class="token function">Println</span><span class="token punctuation">(</span><span class="token string">&quot;&#x76D1;&#x542C;&#x5931;&#x8D25;&#x3002;&#x3002;&#x3002;&quot;</span><span class="token punctuation">,</span>err<span class="token punctuation">)</span>
        <span class="token keyword">return</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">defer</span> listener<span class="token punctuation">.</span><span class="token function">Close</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment">// &#x5EF6;&#x65F6;&#x5173;&#x95ED;</span>

    <span class="token keyword">for</span> <span class="token punctuation">{</span>
        fmt<span class="token punctuation">.</span><span class="token function">Println</span><span class="token punctuation">(</span><span class="token string">&quot;&#x7B49;&#x5F85;&#x5BA2;&#x6237;&#x7AEF;&#x8FDE;&#x63A5;&#x3002;&#x3002;&#x3002;&quot;</span><span class="token punctuation">)</span>
        conn<span class="token punctuation">,</span> err <span class="token operator">:=</span> listener<span class="token punctuation">.</span><span class="token function">Accept</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment">//&#x7B49;&#x5F85;&#x8FDE;&#x63A5;&#x3002;</span>
        <span class="token keyword">if</span> err <span class="token operator">!=</span> <span class="token boolean">nil</span> <span class="token punctuation">{</span>
            fmt<span class="token punctuation">.</span><span class="token function">Println</span><span class="token punctuation">(</span><span class="token string">&quot;Accept() error=&quot;</span><span class="token punctuation">,</span>err<span class="token punctuation">)</span>
        <span class="token punctuation">}</span><span class="token keyword">else</span> <span class="token punctuation">{</span>
            fmt<span class="token punctuation">.</span><span class="token function">Printf</span><span class="token punctuation">(</span><span class="token string">&quot;&#x8FDE;&#x63A5;&#x6210;&#x529F; conn=%v &#xFF0C;&#x5BA2;&#x6237;&#x7AEF;&#x7684;ip=%v \n&quot;</span><span class="token punctuation">,</span>conn<span class="token punctuation">,</span>conn<span class="token punctuation">.</span><span class="token function">RemoteAddr</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">}</span>

        <span class="token comment">//&#x5F00;&#x4E00;&#x4E2A;&#x534F;&#x7A0B;&#xFF0C;&#x5904;&#x7406;&#x4E00;&#x4E2A;&#x8BF7;&#x6C42;&#x3002;</span>
        <span class="token keyword">go</span> <span class="token function">processTest</span><span class="token punctuation">(</span>conn<span class="token punctuation">)</span>

    <span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code></pre>
<blockquote>
<p>&#x5173;&#x952E;&#x4EE3;&#x7801;&#x8BF4;&#x660E;&#xFF1A;</p>
<p>1&#x3001;&#x76D1;&#x542C;tcp&#x7AEF;&#x53E3;&#xFF1A;<code>listener, err := net.Listen(&quot;tcp&quot;, &quot;0.0.0.0:8888&quot;)</code></p>
<p>2&#x3001;&#x5173;&#x95ED;&#x76D1;&#x542C;&#xFF1A;<code>defer listener.Close()</code></p>
<p>3&#x3001;&#x963B;&#x585E;&#x7B49;&#x5F85;&#x8FDE;&#x63A5;&#xFF1A;<code>conn, err := listener.Accept()</code></p>
<p>4&#x3001;&#x5F00;&#x4E00;&#x4E2A;&#x534F;&#x7A0B;&#xFF0C;&#x5904;&#x7406;&#x4E00;&#x4E2A;&#x8FDE;&#x63A5;&#xFF1A;<code>go processTest(conn)</code></p>
<p>5&#x3001;&#x5173;&#x95ED;&#x8FDE;&#x63A5;&#xFF1A;<code>defer conn.Close()</code></p>
<p>6&#x3001;&#x963B;&#x585E;&#x7B49;&#x5F85;&#x63A5;&#x6536;&#x5BA2;&#x6237;&#x7AEF;&#x4FE1;&#x606F;&#xFF1A;<code>n, err := conn.Read(buf)</code></p>
</blockquote>
<h4 id="2&#x3001;&#x5BA2;&#x6237;&#x7AEF;-clientgo-&#x4EE3;&#x7801;&#x3002;"><a name="2&#x3001;&#x5BA2;&#x6237;&#x7AEF;-clientgo-&#x4EE3;&#x7801;&#x3002;" class="anchor-navigation-ex-anchor" href="#2&#x3001;&#x5BA2;&#x6237;&#x7AEF;-clientgo-&#x4EE3;&#x7801;&#x3002;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>2&#x3001;&#x5BA2;&#x6237;&#x7AEF; client.go &#x4EE3;&#x7801;&#x3002;</strong></h4>
<p>&#x5B9E;&#x73B0;&#x6548;&#x679C;&#xFF1A;&#x5BA2;&#x6237;&#x7AEF;&#x5FAA;&#x73AF;&#x8BFB;&#x53D6;&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x5165;&#xFF0C;&#x5411;&#x670D;&#x52A1;&#x5668;&#x53D1;&#x9001;&#x8BFB;&#x53D6;&#x7684;&#x5185;&#x5BB9;&#x3002;&#x5982;&#x679C;&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x5165; exit&#xFF0C;&#x5BA2;&#x6237;&#x7AEF;&#x5C31;&#x9000;&#x51FA;&#x3002;</p>
<pre class="language-"><code class="lang-go"><span class="token keyword">package</span> main

<span class="token keyword">import</span> <span class="token punctuation">(</span>
    <span class="token string">&quot;bufio&quot;</span>
    <span class="token string">&quot;fmt&quot;</span>
    <span class="token string">&quot;net&quot;</span>
    <span class="token string">&quot;os&quot;</span>
    <span class="token string">&quot;strings&quot;</span>
<span class="token punctuation">)</span>

<span class="token keyword">func</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token comment">//&#x8FDE;&#x63A5;127.0.0.1:8888&#xFF0C;&#x8FD4;&#x56DE;&#x8FDE;&#x63A5;Conn</span>
    conn<span class="token punctuation">,</span> err <span class="token operator">:=</span> net<span class="token punctuation">.</span><span class="token function">Dial</span><span class="token punctuation">(</span><span class="token string">&quot;tcp&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;127.0.0.1:8888&quot;</span><span class="token punctuation">)</span>
    <span class="token keyword">if</span> err <span class="token operator">!=</span> <span class="token boolean">nil</span> <span class="token punctuation">{</span>
        fmt<span class="token punctuation">.</span><span class="token function">Printf</span><span class="token punctuation">(</span><span class="token string">&quot;&#x8FDE;&#x63A5;&#x9519;&#x8BEF; err=%v&quot;</span><span class="token punctuation">,</span> err<span class="token punctuation">)</span>
        <span class="token keyword">return</span>
    <span class="token punctuation">}</span>

    <span class="token comment">//os.Stdin &#x662F;&#x6807;&#x51C6;&#x8F93;&#x5165;&#xFF0C;&#x5C31;&#x662F;&#x7EC8;&#x7AEF;&#x63A7;&#x5236;&#x53F0;&#x3002;&#x4ECE;&#x63A7;&#x5236;&#x53F0;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#x3002;</span>
    reader <span class="token operator">:=</span> bufio<span class="token punctuation">.</span><span class="token function">NewReader</span><span class="token punctuation">(</span>os<span class="token punctuation">.</span>Stdin<span class="token punctuation">)</span>

    <span class="token comment">// &#x5FAA;&#x73AF;&#x8BFB;&#x53D6;&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x5165;&#xFF0C;&#x5411;&#x670D;&#x52A1;&#x5668;&#x53D1;&#x9001;</span>
    <span class="token keyword">for</span> <span class="token punctuation">{</span>

        str<span class="token punctuation">,</span> err <span class="token operator">:=</span> reader<span class="token punctuation">.</span><span class="token function">ReadString</span><span class="token punctuation">(</span><span class="token string">&apos;\n&apos;</span><span class="token punctuation">)</span> <span class="token comment">//&#x963B;&#x585E;&#x7B49;&#x5F85;&#x8F93;&#x5165;</span>
        <span class="token keyword">if</span> err <span class="token operator">!=</span> <span class="token boolean">nil</span> <span class="token punctuation">{</span>
            fmt<span class="token punctuation">.</span><span class="token function">Printf</span><span class="token punctuation">(</span><span class="token string">&quot;&#x4ECE;&#x63A7;&#x5236;&#x53F0;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#x9519;&#x8BEF; err=%v&quot;</span><span class="token punctuation">,</span> err<span class="token punctuation">)</span>
            <span class="token keyword">return</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//&#x8F93;&#x5165;exit&#x9000;&#x51FA;&#x3002;</span>
        <span class="token keyword">if</span> strings<span class="token punctuation">.</span><span class="token function">Trim</span><span class="token punctuation">(</span>str<span class="token punctuation">,</span><span class="token string">&quot;\r\n&quot;</span><span class="token punctuation">)</span> <span class="token operator">==</span> <span class="token string">&quot;exit&quot;</span> <span class="token punctuation">{</span>
            fmt<span class="token punctuation">.</span><span class="token function">Printf</span><span class="token punctuation">(</span><span class="token string">&quot;&#x5BA2;&#x6237;&#x7AEF;&#x9000;&#x51FA;&quot;</span><span class="token punctuation">)</span>
            <span class="token keyword">return</span>
        <span class="token punctuation">}</span>

        <span class="token comment">// &#x628A;&#x6570;&#x636E;&#x53D1;&#x9001;&#x7ED9;&#x670D;&#x52A1;&#x5668;</span>
        n<span class="token punctuation">,</span> err <span class="token operator">:=</span> conn<span class="token punctuation">.</span><span class="token function">Write</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token function">byte</span><span class="token punctuation">(</span>str<span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token keyword">if</span> err <span class="token operator">!=</span> <span class="token boolean">nil</span> <span class="token punctuation">{</span>
            fmt<span class="token punctuation">.</span><span class="token function">Printf</span><span class="token punctuation">(</span><span class="token string">&quot;&#x53D1;&#x9001;&#x6570;&#x636E;&#x9519;&#x8BEF; err=%v&quot;</span><span class="token punctuation">,</span> err<span class="token punctuation">)</span>
            <span class="token keyword">return</span>
        <span class="token punctuation">}</span>
        fmt<span class="token punctuation">.</span><span class="token function">Printf</span><span class="token punctuation">(</span><span class="token string">&quot;&#x53D1;&#x9001;&#x4E86; %d &#x5B57;&#x8282;&#x6570;&#x636E;&#x3002;\n&quot;</span><span class="token punctuation">,</span> n<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code></pre>
<blockquote>
<p>&#x5173;&#x952E;&#x4EE3;&#x7801;&#x8BF4;&#x660E;&#xFF1A;</p>
<p>1&#x3001;&#x8FDE;&#x63A5;127.0.0.1:8888&#xFF0C;&#x8FD4;&#x56DE;&#x8FDE;&#x63A5;Conn&#x3002;<code>conn, err := net.Dial(&quot;tcp&quot;, &quot;127.0.0.1:8888&quot;)</code></p>
<p>2&#x3001;&#x5EFA;&#x7ACB;&#x63A7;&#x5236;&#x53F0;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#x7684;Reader&#xFF1A;<code>reader := bufio.NewReader(os.Stdin)</code></p>
<p>3&#x3001;&#x963B;&#x585E;&#x7B49;&#x5F85;&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x5165;&#xFF1A;<code>str, err := reader.ReadString(&apos;\n&apos;)</code></p>
<p>4&#x3001;&#x628A;&#x6570;&#x636E;&#x53D1;&#x9001;&#x7ED9;&#x670D;&#x52A1;&#x5668;&#xFF1A;<code>n, err := conn.Write([]byte(str))</code></p>
</blockquote>
<h4 id="3&#x3001;&#x8FD0;&#x884C;&#x6548;&#x679C;&#x3002;"><a name="3&#x3001;&#x8FD0;&#x884C;&#x6548;&#x679C;&#x3002;" class="anchor-navigation-ex-anchor" href="#3&#x3001;&#x8FD0;&#x884C;&#x6548;&#x679C;&#x3002;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>3&#x3001;&#x8FD0;&#x884C;&#x6548;&#x679C;&#x3002;</strong></h4>
<ul>
<li><strong>&#x670D;&#x52A1;&#x5668;&#x63A7;&#x5236;&#x53F0;&#xFF1A;</strong></li>
</ul>
<pre class="language-"><code class="lang-bash">&#x670D;&#x52A1;&#x5668;&#x5F00;&#x59CB;&#x76D1;&#x542C;&#x3002;&#x3002;&#x3002;
&#x7B49;&#x5F85;&#x5BA2;&#x6237;&#x7AEF;&#x8FDE;&#x63A5;&#x3002;&#x3002;&#x3002;
&#x8FDE;&#x63A5;&#x6210;&#x529F; <span class="token assign-left variable">conn</span><span class="token operator">=</span><span class="token operator">&amp;</span><span class="token punctuation">{</span> <span class="token punctuation">{</span>0xc00008c2c0<span class="token punctuation">}</span> <span class="token punctuation">}</span> &#xFF0C;&#x5BA2;&#x6237;&#x7AEF;&#x7684;ip<span class="token operator">=</span><span class="token number">127.0</span>.0.1:59028 
&#x7B49;&#x5F85;&#x5BA2;&#x6237;&#x7AEF;&#x8FDE;&#x63A5;&#x3002;&#x3002;&#x3002;
&#x5BA2;&#x6237;&#x7AEF;&#x7684;&#x6570;&#x636E;<span class="token operator">=</span>&#x4F60;&#x597D;
&#x5BA2;&#x6237;&#x7AEF;&#x7684;&#x6570;&#x636E;<span class="token operator">=</span>abc
&#x670D;&#x52A1;&#x7AEF;Read &#x9519;&#x8BEF; <span class="token assign-left variable">err</span><span class="token operator">=</span> <span class="token builtin class-name">read</span> tcp <span class="token number">127.0</span>.0.1:8888-<span class="token operator">&gt;</span><span class="token number">127.0</span>.0.1:59028: wsarecv: An existing connection was forcibly closed by the remote host.
</code></pre>
<ul>
<li><strong>&#x5BA2;&#x6237;&#x7AEF;&#x63A7;&#x5236;&#x53F0;&#xFF1A;</strong></li>
</ul>
<pre class="language-"><code class="lang-bash">&#x4F60;&#x597D;
&#x53D1;&#x9001;&#x4E86; <span class="token number">7</span> &#x5B57;&#x8282;&#x6570;&#x636E;&#x3002;
abc
&#x53D1;&#x9001;&#x4E86; <span class="token number">4</span> &#x5B57;&#x8282;&#x6570;&#x636E;&#x3002;
<span class="token builtin class-name">exit</span>
&#x5BA2;&#x6237;&#x7AEF;&#x9000;&#x51FA;
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"1、网络编程基础","level":"1.4.10.1","depth":3,"next":{"title":"面向对象","level":"1.4.11","depth":2,"ref":"","articles":[{"title":"1、go使用struct实现OOP","level":"1.4.11.1","depth":3,"path":"golang/面向对象/1、go使用struct实现OOP.md","ref":"golang/面向对象/1、go使用struct实现OOP.md","articles":[]},{"title":"2、方法","level":"1.4.11.2","depth":3,"path":"golang/面向对象/2、方法.md","ref":"golang/面向对象/2、方法.md","articles":[]},{"title":"3、封装","level":"1.4.11.3","depth":3,"path":"golang/面向对象/3、封装.md","ref":"golang/面向对象/3、封装.md","articles":[]},{"title":"4、继承","level":"1.4.11.4","depth":3,"path":"golang/面向对象/4、继承.md","ref":"golang/面向对象/4、继承.md","articles":[]},{"title":"5、接口","level":"1.4.11.5","depth":3,"path":"golang/面向对象/5、接口.md","ref":"golang/面向对象/5、接口.md","articles":[]},{"title":"6、多肽","level":"1.4.11.6","depth":3,"path":"golang/面向对象/6、多肽.md","ref":"golang/面向对象/6、多肽.md","articles":[]},{"title":"7、类型断言","level":"1.4.11.7","depth":3,"path":"golang/面向对象/7、类型断言.md","ref":"golang/面向对象/7、类型断言.md","articles":[]}]},"previous":{"title":"网络编程","level":"1.4.10","depth":2,"ref":"","articles":[{"title":"1、网络编程基础","level":"1.4.10.1","depth":3,"path":"golang/网络编程/1、网络编程基础.md","ref":"golang/网络编程/1、网络编程基础.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["donate","copy-code-button","expandable-chapters","prism","prism-themes","-highlight","anchor-navigation-ex","-sharing","sharing-plus"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{"css":["prism-themes/themes/prism-duotone-dark.css"]},"search":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"donate":{"alipay":"/gitbook的使用/Donate/alipay.jpg","alipayText":"支付宝打赏","button":"捐赠","title":"如果您觉得有用，请我喝杯水。","wechat":"/gitbook的使用/Donate/wechat.png","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"prism-themes":{},"copy-code-button":{},"sharing":{"qq":true,"all":["weibo","douban","google","line","hatenaBookmark","instapaper","viber","vk","whatsapp","stumbleupon","messenger"],"douban":false,"facebook":true,"weibo":true,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":true,"linkedin":true},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"wk","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"王坤个人博客","language":"zh-hans","links":{"sidebar":{"我的博客地址":"https://my.oschina.net/kunBlog"}},"gitbook":"3.2.3","description":"王坤个人博客"},"file":{"path":"golang/网络编程/1、网络编程基础.md","mtime":"2020-02-01T04:13:06.495Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-01T11:40:27.319Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

